from flask import Flask, session

app = Flask(__name__)

class DefaultConfig(object):
    #设置SECRET_KEY
    SECRET_KEY = '123456'

app.config.from_object(DefaultConfig)

@app.route('/')
def index():
    # 设置session
    session['name'] = 'zhangsan'
    # 获取
    name = session.get('name')
    return 'hello, {}'.format(name)


if __name__ == '__main__':
    app.run()